Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Object not spawining on the player help?

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

0

Any errors. And what is target?

0

Any errors. And what is target?

1 answer

First, is this local script, if not change it in to local now. Second, why you do this human.WalkSpeed = "0", because you can't change the humanoid WalkSpeed by string, it has to be number.

This discussion is preserved as it was. New answers, comments, and votes are closed.