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

How do I make a TextButton when it's clicked make a part change the properties?

Asked by 5 years ago
Edited 5 years ago

So I have been trying to make a script where my text button when it is clicked will change a parts properties.

This is my script, yes a normal script.

script.Parent.MouseButton1Click:Connect(function()
    game.Workspace.Part.CanCollide = true
    game.Workspace.Part.Transparency = 0
end)

Can you please tell me what is wrong? Thank you.

1 answer

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

It's wrong because it's not using FE.

Make sure this script is a local script:

script.Parent.MouseButton1Click:Connect(function()
        game.ReplicatedStorage.FireableEvent:FireServer()
end)

In the ServerScriptService, make a server script.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = Instance.new("RemoteEvent", ReplicatedStorage)
Event.Name = "FireableEvent"
local function onFiredEventEvent(Player)
     game.Workspace.Part.CanCollide = true
     game.Workspace.Part.Transparency = 0
end
Event.OnServerEvent:Connect(onFiredEventEvent)
0
Okay! Let me try the script. xBenDaii 0 — 5y
Ad

Answer this question