print("script starts")
local Player
local Part = script.Parent
local function playerHasTool(player, toolName)
local tool = player.Backpack:FindFirstChild(toolName) or player.Character:FindFirstChild(toolName)
if tool then
return true
else
return false
end
end
print("Aftertoolrecog")
local Player
Part.Touched:Connect(function(HIT)
Player = game.Players:GetPlayerFromCharacter(HIT.Parent)
local H = HIT.Parent:FindFirstChild("Humanoid")
print("Before conditional")
if H and not playerHasTool(Player,"MediterraneanAvenue") and not game.ReplicatedStorage:FindFirstChild("MediterraneanAvenue") then
print("Conditional checked")
game.ReplicatedStorage.PayRent:FireClient(Player)
print("event fired")
end
end)
this script is supposed to fire the event when a player steps on a part in workspace (this is a script inside that part in workspace). The conditionals work well in test mode but when I try it after publishing the game, it doent work. Why does this happen? Please help me!

1 comment
Try enabling studio api services..