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

Why does this script not seem to work after the latest update?

Asked by 5 years ago

I am fairly new to Roblox Studio, I just started making a new script for a screen gui that when it is clicked it will do something, this is it:

(Parent is a Text Button in this case)

*script.Parent.MouseButton1Click:Connect(function()

game.Workspace.Baseplate.Transparency = 1

end)*

It had worked for me many times before, but recently it has not worked. After a while of messing around with literally everything i could find, I just can't tell if i have done something wrong or if there was something changed.

0
Is this a script or local script? User#19524 175 — 5y
0
This must be a normal script. It might be lag. Check to see if the script is disable. iWagen 5 — 5y
0
its not a local script, and its not disabled. codee21 4 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

The reason you're not seeing anything happen is because you created the code in a Script instead of a LocalScript. Try doing that first. (If I got this wrong, you can skip this part.)

With the LocalScript code, the baseplate will only turn invisible for the player clicking the button in the GUI at that time. If that is your intended effect, you can stop there. However, if you want this to be replicated, I think this ROBLOX Wiki article about remote functions and events will help you make it invisible for the entire server.

After reading the article, we can try this with both the LocalScript from the GUI and a Script communicating via a RemoteEvent:

---------------------------------
-- In GUI (LocalScript): --
---------------------------------

local event = game.ReplicatedStorage:WaitForChild("InvisibleBaseplate") -- Replace the name in quotes with the name of the event made by the script.
script.Parent.MouseButton1Click:Connect(function()
    event:FireServer()
end)

---------------------------------
--      Server (Script)     --
---------------------------------

event = Instance.new("ReplicatedStorage")
event.Name = "InvisibleBaseplate"
event.Parent = game.ReplicatedStorage

event.OnServerEvent:Connect(function(player)
    print("baseplate made invisible by "..player.Name)
    game.Workspace.Baseplate.Transparency = 1
end)

If this answer helped you, you can click the Accept button. If I made a mistake in any part of this or you have a question about this, you can make a comment on my answer by looking at the box below.

0
Thanks :D codee21 4 — 5y
0
No problem! KicksForTricks56 36 — 5y
Ad

Answer this question