s = script.Parent
s.ClickDetector.MouseClick:connect(function(p)
local gui = p.PlayerGui
if p.Data.Tries.Value >= 1 and gui then
gui.Spin.Frame.Visible = true
end
end)
✓ ANSWER ACCEPTED
Spin is not a valid member of PlayerGui ?
1 answer
✓ Accepted answer
The PlayerGui in the Server is not replicated or changeable, so you will either have to use Remote Events and Functions See Here: https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events
Example:
Server Script
local remote = game.ReplicatedStorage.RemoteEvent
local s = script.Parent
s.ClickDetector.MouseClick:Connect(function(p)
remote:FireClient(p)
end)
Local Script in StarterGui
local remote = game.ReplicatedStorage.RemoteEvent
local p = game.Players.LocalPlayer
remote.OnClientEvent:Connect(function()
if p:FindFirstChild("Data") ~= nil and p.Data.Tries.Value >= 1 then
script.Parent.Spin.Frame.Visible = true
end
end)
The above example has a Remote Event named "RemoteEvent" in Replicated Storage
OR
Use a LocalScript within StarterGui
local p = game.Players.LocalPlayer
local s = workspace.Part
s.ClickDetector.MouseClick:Connect(function()
local gui = script.Parent
if p.Data.Tries.Value >= 1 and gui then
gui.Spin.Frame.Visible = true
end
end)
In addition, make sure that "Spin" is under the StarterGui when you start the game.
This discussion is preserved as it was. New answers, comments, and votes are closed.
