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

How do I fix this script I'm trying to to make a brick teleport part to a player when you hit q?

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

mouse.KeyDown:connect(function(key)
	if key == "q" then
		local torso = workspace:FindFirstChild("UpperTorso")
		local part = game.ReplicatedStorage.Part:Clone()
		part.Postion = torso.Postion
		part.Parent = game.Workspace
	end
end)

Thank you for reading

3 comments

0

Is UpperTorso part of a player or a part you named UpperTorso in the workspace?

0

are you using the right morph? (R15 or R6?) nobody in roblox is named workspace, so you didnt do it right. plus, dont teleport them using a localscript, rather, sent an event that makes a server script do the work.

0

UpperTorso is the Torso of the player im using r15

1 answer

Your script isn't working because Position isn't spelled correctly. This one might work:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

mouse.KeyDown:connect(function(key)
    if key == "q" then
        local torso = workspace:FindFirstChild("UpperTorso")
        local part = game.ReplicatedStorage.Part:Clone()
        part.Position = torso.Position
        part.Parent = game.Workspace
    end
end)

1 comment

0

didnt work Players.hadiya7866.PlayerScripts.LocalScript:8: attempt to index nil with 'Position'

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