Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I change properties via events?

Asked by 5 years ago

I have a good understanding of events and how they work, yet I have no idea how to make them change the properties of objects. By objects, I mean I need to know how to change both the properties of an object that I stepped on and the properties of an object completely separated from the one I just stepped on.

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

If you want to change to properties of parts when touched I recommend using this:

01local object = game.Workspace.Object
02local touchedPart = script.Parent
03 
04touchedPart.Touched:Connect(function(hit)
05    if hit.Parent:FindFirstChild("Humanoid") then
06        touchedPart.BrickColor = BrickColor.new("Really blue") -- change brickcolor
07        object.Position = Vector3.new(5,5,5) -- change poistion
08        object.Size = Vector3.new(10,10,10) -- change size
09    end
10end)

This script is located inside touchedPart

Ad

Answer this question