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

How do I change a tool location?

So , when ever this function got called it will spawn a random Item


local function SpawnItems()

local Items = game.ReplicatedFirst.CrateItems:GetChildren()
local RandomItem = Items[math.random(1, #Items)]
print(RandomItem.Name.." Chosen.")
RandomItem:Clone().Parent = game.Workspace
print(RandomItem.Name.." Spawned.")
RandomItem.Main.CFrame = CFrame.new(TargetLocation)
print(RandomItem.Name.." Moved.")

end

using

RandomItem.Main.CFrame = CFrame.new(TargetLocation)

doesn't make the 'tool' be at a certain locaton.

How do I change a 'tool' location?

1 comment

0

you need to set spawn points around the map. Use math.random(1, #spawnpoints) and set the tool's CFrame to the chosen spawn point

1 answer

✓ Accepted answer

To do this you will have to change the Handle of the tools CFrame heres an example

wait()
local location = game.Players.LocalPlayer.Character.Head.Position
game.Workspace.Handgun.Handle.CFrame = CFrame.new(location)

This would teleport it to the players head and make them equip it.

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