So im making a enemy tool script for my game, and basically what the system is is that if the player takes long enough to collect a tool, the monster will collect the tool in the map
And im making a test by teleporting the player to the tool
And im making it so its more optimized by removing the spaces of the item names and using them to get the item on toollocations table
But theres an error saying CFrame expected, got nil
Can anyone help me with that?
The Script
local toollocations = {
BraveHammer = CFrame.new(1,1,1)
}
for i,v in pairs(game.Workspace.ToolLocations) do
local newv = string.gsub(v, " ", "")
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = newv
end