When I was working on my game, I decided I would have a block that gives the player an item and teleports them to a certain place. For some reason, however, the item giver isn't working. I made the script a local script.
local teleblox = game.Workspace.BloxxerStatueModel.TheBStatue.Teleporter local Fight = game.ServerStorage.Fight local FightClone = Fight:Clone() local function pint() FightClone.Parent = game.Players.LocalPlayer.Backpack print("oml it worked") end script.Parent:findFirstChild("Humanoid")(pint)
You need an event that will detect when the player is touching the block. In this case, Touched should do.
local teleblox = game.Workspace.BloxxerStatueModel.TheBStatue.Teleporter local Fight = game.ServerStorage.Fight local FightClone = Fight:Clone() script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then FightClone.Parent = game.Players.LocalPlayer.Backpack print("oml it worked") end end)
Assuming that you are placing the script within whatever block you need to touch.
Assuming you want to use a touch event, here is what I made.
local teleblox = game.Workspace:WaitForChild('Teleporter') local Fight = game.ReplicatedStorage:WaitForChild('Fight') local tp = -23.36, 0.5, 26.03 debounce = 0 function pint(hit) if debounce == 0 then debounce = 1 if hit.Parent:FindFirstChild('Humanoid') ~=nil then local pn = hit.Parent.Name local p = game.Players:FindFirstChild(pn) local FightClone = Fight:Clone() FightClone.Parent = p.Backpack hit.Parent:FindFirstChild('HumanoidRootPart').Position = Vector3.new(-23.36, 0.5, 26.03) print("ommeeee gaaawdd it worked") wait(1) debounce = 0 end end end script.Parent.Touched:Connect(pint)
p.s - sorry it took so long