Basically, I have a shop that when you step on a brick it fires a event and opens a GUI. The script works on studio, but not normal Roblox. This is the script, nothing wrong with it.
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) game.ReplicatedStorage:WaitForChild("TriggerCam"):FireClient(player) end end)
heres the script that detects when TriggerCam is fired, inside StarterGui and is local
game.ReplicatedStorage:WaitForChild("TriggerCam").OnClientEvent:Connect(function() local player = game.Players.LocalPlayer local shop = player.PlayerGui.Shop local camera = workspace.CurrentCamera local mainshop = workspace.Shop local item = shop.Item local buy = shop.Frame.Buy local shadow = buy.Shadow local Players = game:GetService("Players") local localPlayer = Players.LocalPlayer local humanoid = localPlayer.Character:FindFirstChildOfClass("Humanoid") local MainShop = player.PlayerGui.MainShop if shop.Closed.Value == false then if shop.Open.Value == false then shop.Open.Value = true game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All,false) MainShop.Enabled = false humanoid:UnequipTools() shop.Frame:TweenPosition(UDim2.new(0,0,0,0),"Out","Quint",1,true) shop.Item.Value = 1 camera.CameraType = Enum.CameraType.Scriptable camera.CameraSubject = mainshop.Cam1 camera.CFrame = mainshop.Cam1.CFrame shop.Frame.TextLabel.Text = mainshop:FindFirstChild("Part"..shop.Item.Value).ItemName.Value shop.Frame.Buy.Text = mainshop:FindFirstChild("Part"..shop.Item.Value).ItemPrice.Value if player.Backpack:FindFirstChild(workspace.Shop:FindFirstChild("Part"..item.Value).ItemName.Value) ~= nil then buy.Text = "Owned" buy.BackgroundColor3 = Color3.new(0.7,0.7,0.7) shadow.BackgroundColor3 = Color3.new(0.5,0.5,0.5) else buy.Text = workspace.Shop:FindFirstChild("Part"..item.Value).ItemPrice.Value buy.BackgroundColor3 = Color3.fromRGB(85,255,127) buy.BackgroundColor3 = Color3.fromRGB(70, 212, 104) end end end end)