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

Can you answer a quick simple question?

Asked by
epoke466 100
2 years ago

(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)
0
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. RAFA1608 543 — 2y
0
Thank you, If I ran both scripts on the client or both scripts on the server do you think that it would work? epoke466 100 — 2y
0
Nvm, I got it working with a remote event epoke466 100 — 2y
0
Nvm, I got it working with a remote event epoke466 100 — 2y

Answer this question