Script works in studio but only partially in game

I can’t for the life of me figure out what the issue is here?
In studio it works perfectly fine but in game it only prints “test2o” and it won’t do anything else.

here is the script, it is located in StarterPlayerScripts

local player = game.Players.LocalPlayer
local eq : RemoteEvent = game.Workspace.Scripts:WaitForChild("gain")
local kni : RemoteEvent = game.ReplicatedStorage.itemevents.k
local ham : RemoteEvent = game.ReplicatedStorage.itemevents:WaitForChild("h")
local star : RemoteEvent = game.ReplicatedStorage.itemevents:WaitForChild("p")

eq.OnClientEvent:Connect(function()
	print("test2o")
	local CHOOSE = player.Equip
	
	if CHOOSE.Value == 0 then
		kni:FireServer(player)
		print("testfireserverugh")
	
	else if CHOOSE.Value == 1 then
		ham:FireServer()
	
	else if CHOOSE.Value == 2 then
		star:FireServer()
	end
		end
			end
end)

elseif is written together and if and elseif is one block only so remove the

eq.OnClientEvent:Connect(function()
	print("test2o")
	local CHOOSE = player.Equip

	if CHOOSE.Value == 0 then
		kni:FireServer(player)
		print("testfireserverugh")
		
	elseif CHOOSE.Value == 1 then
		ham:FireServer()

	elseif CHOOSE.Value == 2 then
		star:FireServer()
	end
end)
1 Like

it still doesn’t work unfortunately

That means your value is 3 or above

i didn’t even think of that! it was a datastore issue, thank you

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.