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 4 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 4 years ago
Edited 4 years ago

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

local object = game.Workspace.Object
local touchedPart = script.Parent

touchedPart.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        touchedPart.BrickColor = BrickColor.new("Really blue") -- change brickcolor
        object.Position = Vector3.new(5,5,5) -- change poistion
        object.Size = Vector3.new(10,10,10) -- change size
    end
end)

This script is located inside touchedPart

Ad

Answer this question