I am trying to make it so that if a player picks up an item in one place, they will then have that item in all the other places. My script returns 0 errors in either place, I have checked locally and server sided for errors.
here are my scripts:
scripts inside place 1:
--In a localscript
local TPServ = game:GetService("TeleportService")
local Player = game.Players.LocalPlayer
local TPData = TPServ:GetLocalPlayerTeleportData()
pcall(function()
if TPData.LighterGrabbed == true then
game.ReplicatedStorage:WaitForChild("XrjI19OmHYpLL78"):FireServer(Player)
end
end)
other script in place 1:
--in a serverscript
local RStorage = game:GetService("ReplicatedStorage")
local ToolEvent = RStorage:WaitForChild("XrjI19OmHYpLL78")
local function GiveLighter(Plr)
local NewLighter = RStorage.Lighter:Clone()
NewLighter.Parent = Plr.Backpack
end
ToolEvent.OnServerEvent:Connect(GiveLighter)
script in place 2:
--in a serverscript
local TPServ = game:GetService("TeleportService")
local TPBlock = game.Workspace.Sign
local TPiD = 6962590239
local TPData = {
LighterGrabbed = false
}
TPBlock.Touched:Connect(function(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if Hit.Parent:FindFirstChild("Humanoid") then
if Hit.Parent:FindFirstChild("Lighter") or Player.Backpack:FindFirstChild("Lighter") then
TPData["LighterGrabbed"] = true
end
TPServ:Teleport(TPiD, Player, TPData)
end
end)
anyone know what Im doing wrong? I cannot figure it out, also I know that the scripts are not secure and could be abused by exploiters, I am gonna add a anti cheat later.