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)

5 comments

0

It's not an error, it's a warning. Basically what it means is that it is possible that the script will wait permanently for TriggerCam until it exists. If you are sure that TriggerCam exists, you can ignore this warning.

0

When you play a game normally certain assets of the game needs more time to load than in studio, and if you are waiting for an object to load for a period of time (probably 5 seconds), this warning will appear.

0

there is a event named TriggerCam in repliacted storage. no matter how long u wait, it still dosent work

0

Can we see the script where it detects when you fire the remoteevent?

0

Edited