I'm trying to spawn a box on the player and their surrounding area to slow them and those nearby down.
The problem I'm facing is that the box is spawning just not on the player, instead it's spawning where I had originally created the box
Here's the code, any help would be much appreciated:
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
local tEBox = game.ReplicatedStorage:WaitForChild("timeEraseBox")
local human = char:WaitForChild("Humanoid")
local userInput = game:GetService('UserInputService')
userInput.InputBegan:Connect(function(key)``
if key.KeyCode == Enum.KeyCode.F then
local tEBoxClone = tEBox:Clone()
tEBoxClone.Parent = game.Workspace
tEBoxClone.SetPrimaryPartCFrame(target.CFrame)
script.Parent.Touched:connect(function(hit)
if hit.Parent.Humanoid then
_G.isSprinting = false
human.WalkSpeed = "0"
end
end)
end
end)

2 comments
Any errors. And what is target?
Any errors. And what is target?