Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I change a tool location?

Asked by 6 years ago

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?

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 hellmatic 1523 — 6y

1 answer

Log in to vote
0
Answered by
Prestory 1395 Moderation Voter
6 years ago

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.

Ad

Answer this question