Discuss Scratch

Potato_RandJ
Scratcher
2 posts

Roblox Studio Topic

k0d3rrr wrote:

BuzzedOut wrote:

k0d3rrr wrote:

So, can we share scripts we made on Roblox Studio?
First poster of this topic!
Hmm… I’d guess. We could also (of course) share pictures of what we’ve built / games we’re working on, but scripts would make sense too.
Okay, I'll go first!

Here's a script I made in Roblox Studio for a shovel tool:
wait(1)
Shovel = script.Parent
Appear = script.Appear
Dig = script.Dig
Tool = script.Parent.Parent
Tool.CanBeDropped = false
Tool.Enabled = true
Terrain = workspace.Terrain
function Activate()
	Shovel.Anchored = false
	Tool.Enabled = false
	print("Tool being used.")
	Shovel.Orientation = Vector3.new(0, 0, 90)
	Shovel.Position = Shovel.Position - Vector3.new(0, 2, 0)
	Dig:Play()
	wait(0.65)
	Shovel.Orientation = Vector3.new(0, 0, 0)
	Shovel.Position = Shovel.Position + Vector3.new(0, 2, 0)
	Terrain:FillBall(Shovel.Position, 10, Enum.Material.Air)
	Tool.Enabled = true
end
function Hold()
	print("Shovel held.")
	Shovel.Anchored = false
	Appear:Play()
	Shovel.Orientation = Vector3.new(0, 0, 0)
end
function Touch()
	print("Shovel touched.")
	Shovel.Anchored = false
end
Tool.Equipped:Connect(Hold)
Tool.Activated:Connect(Activate)
Shovel.Touched:Connect(Touch)
The “wait(1)” command at the start is to stop the script from failing to load everything.

Or, for something really simple:

print('Hello, World!')
Thats A LOT Of Code. But, yes it works. I did not test it in studio, but from what I learned it does
BuzzedOut
Scratcher
500+ posts

Roblox Studio Topic

Potato_RandJ wrote:

k0d3rrr wrote:

BuzzedOut wrote:

k0d3rrr wrote:

So, can we share scripts we made on Roblox Studio?
First poster of this topic!
Hmm… I’d guess. We could also (of course) share pictures of what we’ve built / games we’re working on, but scripts would make sense too.
Okay, I'll go first!

Here's a script I made in Roblox Studio for a shovel tool:
 - snip - 
The “wait(1)” command at the start is to stop the script from failing to load everything.

Or, for something really simple:

print('Hello, World!')
Thats A LOT Of Code. But, yes it works. I did not test it in studio, but from what I learned it does

Seeing as big games have scripts with over 1000 lines, scripts tend to get pretty big lol


pkhead
Scratcher
1000+ posts

Roblox Studio Topic

BuzzedOut wrote:

Potato_RandJ wrote:

k0d3rrr wrote:

BuzzedOut wrote:

k0d3rrr wrote:

So, can we share scripts we made on Roblox Studio?
First poster of this topic!
Hmm… I’d guess. We could also (of course) share pictures of what we’ve built / games we’re working on, but scripts would make sense too.
Okay, I'll go first!

Here's a script I made in Roblox Studio for a shovel tool:
 - snip - 
The “wait(1)” command at the start is to stop the script from failing to load everything.

Or, for something really simple:

print('Hello, World!')
Thats A LOT Of Code. But, yes it works. I did not test it in studio, but from what I learned it does

Seeing as big games have scripts with over 1000 lines, scripts tend to get pretty big lol
that retro studio clone i was making had over 10k lines of code. also, generally, try not to make scripts too long. if it goes over 1000 lines of code it may need some modularizing (separating some systems in the code into a separate ModuleScript)
pkhead
Scratcher
1000+ posts

Roblox Studio Topic

I found out how to make an object look towards something without it flipping whenever it crosses an axis. You take a reference CFrame and the target point, and rotate the CFrame along an axis to face the target point. Not really that complicated, but I remember I couldn’t figure out how to do this a year ago for a marble game I was making where you can stick on walls. The camera would change rotation based on the direction of the wall, but it would jarringly flip sometimes.

Here’s the code that does this:
local function cfLookAt(refCf: CFrame, target: Vector3): CFrame
	-- The axis of rotation is perpendicular to the refCf's LookVector and the target direction
	local axis = refCf.LookVector:Cross(target).Unit
	-- Get the angle between reference LookVector and target direction
	local angleOffset = math.acos(refCf.LookVector:Dot(target.Unit))
	-- Return reference CFrame rotated along axis by angleOffset radians
	return refCf * CFrame.fromAxisAngle(axis, angleOffset)
end
I can’t use my computer right now so I just tried rewriting the code from memory. As such, it’s not tested and may not work.

This is useful for inverse kinematics. I know that because I used this for inverse kinematics. Also useful for games where you can stick on walls, and the camera changes direction based on the wall.
BuzzedOut
Scratcher
500+ posts

Roblox Studio Topic

bump, will post some stuff I made soon


BuzzedOut
Scratcher
500+ posts

Roblox Studio Topic

Another bump… I haven’t really made much recently but I was thinking of working on a small project.


EveryPizza
Scratcher
100+ posts

Roblox Studio Topic

Some screenshots of my game:


Play it here: https://rblx.games/10214969603
I sometimes use https://you.com/code for AI code help.

Generation 4: the first time you see this copy and paste it on top of your sig in the scratch forums and increase generation by 1. Social experiment.


i have pneumonoultramicroscopicsilicovolcanoconiosis and hippopotomonstrosesquippedaliophobia
BuzzedOut
Scratcher
500+ posts

Roblox Studio Topic

Bump!
Been working on a few projects recently, once I figure out some basic code and the anti-cheat I’ll probably release an alpha version!
I also modeled a White Castle (restaurant). Only the exterior since making furniture is hard.. I might do the interior soon though. I’ll post it here in a little…
I also got my first Talent Hub job! Just some basic UI

Last edited by BuzzedOut (June 16, 2023 07:56:57)



ZanterZlox
Scratcher
1000+ posts

Roblox Studio Topic

I tried using Roblox Studio once.
big mistake
Mostly because I had no clue what I was doing.

I took signature quite literally

pkhead
Scratcher
1000+ posts

Roblox Studio Topic

BuzzedOut wrote:

Bump!
Been working on a few projects recently, once I figure out some basic code and the anti-cheat I’ll probably release an alpha version!
I also modeled a White Castle (restaurant). Only the exterior since making furniture is hard.. I might do the interior soon though. I’ll post it here in a little…
I also got my first Talent Hub job! Just some basic UI
I forgot about the Talent Hub thing. Perhaps I could do some scripting jobs. I probably need like, a portfolio first though, with finished games…
pkhead
Scratcher
1000+ posts

Roblox Studio Topic

ZanterZlox wrote:

I tried using Roblox Studio once.
big mistake
Mostly because I had no clue what I was doing.
Roblox Studio is probably one of the more easy-to-learn game engines. You could make some sort of social hangout game without much scripting knowledge.
ZanterZlox
Scratcher
1000+ posts

Roblox Studio Topic

pkhead wrote:

ZanterZlox wrote:

I tried using Roblox Studio once.
big mistake
Mostly because I had no clue what I was doing.
Roblox Studio is probably one of the more easy-to-learn game engines. You could make some sort of social hangout game without much scripting knowledge.
I was overwhelmed with all the buttons and stuff. I'm also not very experienced with computers sooooooo

I took signature quite literally

pkhead
Scratcher
1000+ posts

Roblox Studio Topic

ZanterZlox wrote:

pkhead wrote:

ZanterZlox wrote:

I tried using Roblox Studio once.
big mistake
Mostly because I had no clue what I was doing.
Roblox Studio is probably one of the more easy-to-learn game engines. You could make some sort of social hangout game without much scripting knowledge.
I was overwhelmed with all the buttons and stuff. I'm also not very experienced with computers sooooooo
that's why guides and tutorials exist
(if you have the patience to read)

Last edited by pkhead (June 17, 2023 05:25:12)

DifferentDance8
Scratcher
1000+ posts

Roblox Studio Topic

pkhead wrote:

ZanterZlox wrote:

pkhead wrote:

ZanterZlox wrote:

I tried using Roblox Studio once.
big mistake
Mostly because I had no clue what I was doing.
Roblox Studio is probably one of the more easy-to-learn game engines. You could make some sort of social hangout game without much scripting knowledge.
I was overwhelmed with all the buttons and stuff. I'm also not very experienced with computers sooooooo
that's why guides and tutorials exist
(if you have the patience to read)
or if you want to go back to watching youtube

Mod's Protogen Maker v2 released. I will update it when I will update it
BuzzedOut
Scratcher
500+ posts

Roblox Studio Topic

ZanterZlox wrote:

I tried using Roblox Studio once.
big mistake
Mostly because I had no clue what I was doing.
At first it is… very overwhelming. I felt the same with blender lol. In the end you only really use half of them anyways, but if you spend a few hours learning it it really helps. It is possible to learn without tutorials (the basics) although I did that myself and it is very slow

Last edited by BuzzedOut (June 17, 2023 10:44:12)



BuzzedOut
Scratcher
500+ posts

Roblox Studio Topic

pkhead wrote:

BuzzedOut wrote:

Bump!
Been working on a few projects recently, once I figure out some basic code and the anti-cheat I’ll probably release an alpha version!
I also modeled a White Castle (restaurant). Only the exterior since making furniture is hard.. I might do the interior soon though. I’ll post it here in a little…
I also got my first Talent Hub job! Just some basic UI
I forgot about the Talent Hub thing. Perhaps I could do some scripting jobs. I probably need like, a portfolio first though, with finished games…
Yeah, I find the two main problems with Talent Hub are that every job require “previous work” but you can never really get any work unless you either make your own game (which takes ages) or do another job (which requires previous work), or the job pays like 10 robux for wayy too much work


BuzzedOut
Scratcher
500+ posts

Roblox Studio Topic

bump


-VortexTV-
Scratcher
33 posts

Roblox Studio Topic

What if I just took all the scripts in this forum topic and compiled them into one little game that does pretty much nothing

If you see this message go to my profile and comment your favorite band/musician
pkhead
Scratcher
1000+ posts

Roblox Studio Topic

-VortexTV- wrote:

What if I just took all the scripts in this forum topic and compiled them into one little game that does pretty much nothing
Yes please take this snippet of code which took about an hour to think through
local function cfLookAt(refCf: CFrame, target: Vector3): CFrame
	-- The axis of rotation is perpendicular to the refCf's LookVector and the target direction
	local axis = refCf.LookVector:Cross(target).Unit
	-- Get the angle between reference LookVector and target direction
	local angleOffset = math.acos(refCf.LookVector:Dot(target.Unit))
	-- Return reference CFrame rotated along axis by angleOffset radians
	return refCf * CFrame.fromAxisAngle(axis, angleOffset)
end
-_-Onscratch
Scratcher
100+ posts

Roblox Studio Topic

I even wrote my own custom humanoid to more accurately emulate old Roblox humanoids. (For example, in the old behavior, when landing, the character starts slightly penetrating the surface, then slowly glides to directly on top. I emulated this using a BodyPosition.
does it work with the server and not just the client?

Last edited by -_-Onscratch (June 20, 2023 03:53:00)

Powered by DjangoBB