(Make sure to hit "View Scorce" next to the script so you can see the whole thing)
I have a part in workspace with a script in it:
function OnTouch(hit)
if hit.Parent:FindFirstChildOfClass("Humanoid") then
game.Players:GetPlayerFromCharacter(hit.Parent).PlayerGui.Wraps.Frame.Visible = true
game.Players:GetPlayerFromCharacter(hit.Parent).Character:MoveTo(Vector3.new(-25, 405, 375))
end
end
script.Parent.Touched:Connect(OnTouch)
When the player touches it a gui is supposed to pop up. This gui pops up the first time but it doesn't the second time I touch the part though the player still moves. Dose anyone know why.
P.S. Here is the script for the close button in the gui:
local Wraps = game.Players.LocalPlayer:WaitForChild("Wraps")
function Close()
script.Parent.Visible = false
end
wait(3)
local PlayerValue = Instance.new("ObjectValue", script.Parent)
PlayerValue.Name = "Player"
PlayerValue.Value = game.Players.LocalPlayer
for i, wrap in pairs(Wraps:GetChildren()) do
local CurrentButton = script.Template:Clone()
CurrentButton.Name = wrap.Name
CurrentButton.Text = wrap.Name
CurrentButton.Value = wrap
end
script.Parent.Close.MouseButton1Click:Connect(Close)

4 comments
Oh, you see, the server won't update the client on whether the gui is visible or not if the client itself closes it. Think it as a jammed button, the server won't make any attempts to unjam it because you didn't tell it to. Technically, you did, but since it was the same value as before, it didn't update the value on the clients.
Thank you, If I ran both scripts on the client or both scripts on the server do you think that it would work?
Nvm, I got it working with a remote event
Nvm, I got it working with a remote event