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

Script that shows GUI when stepped on a part works in studio but not in the roblox game?

Asked by 6 years ago

My script that i made is supposed to show an GUI when you step on the specific block. It works on studio but not ingame. Could someone help me ? here is the script:

01script.Parent.Touched:connect(function(hit)
02    if hit.Name == ("Right Leg") or hit.Name == ("Left Leg") then
03for i,v in pairs(game.Players:GetPlayers()) do
04    v.Character.Torso.CFrame = v.Character.Torso.CFrame * CFrame.new(2,2,2)
05local cam = workspace.CurrentCamera
06cam.CFrame = workspace.carroom.Cam.CFrame
07cam.CameraType = "Scriptable"
08v.PlayerGui.Upgradeshop.Enabled = true
09for a,k in pairs(v:GetChildren()) do
10    if k:IsA("Model") then
11        k:Destroy()
12    end
13end
14wait(1)
15if v.SelectedCar.Value == nil then
View all 28 lines...

1 answer

Log in to vote
0
Answered by 6 years ago

Is your script FE? If not, then set it to be, you won't regret it, trust me. You should put the part of the script that makes the gui appear in a local script inside the player and tie it with the script which detects the touch using a remoteevent (if you want the gui to appear on all players, just do :FireAllClients (or something like that))

If you don't understand, you should probably look up remote events.

0
Sadly, that didnt work. I tried OnServerEvent and it works an studio, but not ingame and it shows an error ingame that it only works for the server. Then i tried OnClientEvent and it didnt work for both. did i do something wrong? ieatandisbaconhair 77 — 6y
Ad

Answer this question