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

This works in studio... yet when I play it in game it doesn't work! HELP?

Asked by 7 years ago
Edited 7 years ago
enabled = false

function onTouched(hit)
wait(3)
game.Players.LocalPlayer.PlayerGui.paint.Frame.Visible = true
enabled = true
if enabled == false then
game.Players.LocalPlayer.PlayerGui.paint.Frame.Visible = false

end
end

script.Parent.Touched:connect(onTouched)
0
is it a local script in startergui? Senor_Chung 210 — 7y
0
no... its a script in the brick. Say you want to get your car painted... You drive up and the gui shows up... the gui is in startergui. And the script i'm having trouble with is in the paintbrick <--- the otouched brick. NateDawgGamingRoHD 5 — 7y
0
It works in studio because in Play mode the client and server are together meaning you can access the player with a server script, however when the game is played the server and client aren't together meaning a server script cant access the client. That's the simplest terms I can put it in... SHDrivingMeNuts 299 — 7y
1
Only local scrips have access to the LocalPlayer variable, server scripd do not. You will have yo use hit.Parent to try and find a player. User#5423 17 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Im a beginner but Imma try help. They might be wrong so no high hopes.

enabled = false

function onTouched(hit)
wait(3)
game.Players:FindFirstChild(hit.Parent.Name).PlayerGui.paint.Frame.Visible = true
enabled = true
if enabled == false then
game.Players:FindFirstChild(hit.Parent.Name).PlayerGui.paint.Frame.Visible = true

end
end

script.Parent.Touched:connect(onTouched)

otherwise try this??? Place GUI into this script. Make sure the GUI is visible Then also add in the X (or close) button???

local gui1 = script.paint

function onTouched(player)
    local newgui2 = gui1:Clone()
    newgui2.Parent = player.PlayerGui
end

script.Parent.Touched:connect(onTouched)
Ad

Answer this question