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

How would I make a script where the property changes to certain parts in a model?

Asked by 4 years ago

I don't have a script because I don't know where to even start with this. I'm trying to make a switch where when you press one side, it changes a few properties in a set of bricks, and when you touch the other side it disables the first set and activates the second set.

If anybody could point me in the right direction to make this that would help immensely, thanks.

1 answer

Log in to vote
0
Answered by 4 years ago

Your going to start with two touch events on each part u want to change the properties with. Then you are going to set the property that the other part changes to the original value and change the desired property for when you touch that object.

local Players = game:GetService('Players')

local Part = workspace.Part -- Define Part

local OriginalTransparency = Part.Transparency
local OriginalReflectance = Part.Reflectance

Part1.Touched:Connect(function(Obj)
    local Player = Players:GetPlayerFromCharacter(Obj.Parent)
    if Player then
        Part.Transparency = 1
        Part.Reflectance = OriginalReflectance
    end
end)

Part2.Touched:Connect(function(Obj)
    local Player = Players:GetPlayerFromCharacter(Obj.Parent)
    if Player then
        Part.Reflectance = 1
        Part.Transparency = OriginalTransparency
    end
end)
Ad

Answer this question