I am making a tool where you click somewhere, the object appears at click click location, and the Label's text (in the BillboardGUI) is changed to play.Name"'s Egg" The problems are that the text isn't changed, and the object does not appear at the click location. Here is the error:
18:15:52.301 - Players.TinyScripter.Backpack.Spawn Doge.Script:10: attempt to call global 'CFrame' (a table value)
18:15:52.302 - Stack Begin
18:15:52.303 - Script 'Players.TinyScripter.Backpack.Spawn Doge.Script', Line 10 - upvalue createPart
18:15:52.304 - Script 'Players.TinyScripter.Backpack.Spawn Doge.Script', Line 15
18:15:52.305 - Stack End
Here is the ServerScript:
-- Server Script
local tool = script.Parent
local play = tool.Parent.Parent.Name
local clickEvent = tool.ClickEvent
local clickEventConnection
local function createPart(location)
local part = game.Lighting.DogeEgg:Clone()
part.Parent = workspace
part.CFrame = CFrame(location)
part.ShowName.txt.Text = play.."s Egg"
end
local function onClick(player, clickLocation)
createPart(clickLocation)
end
local function onEquip()
clickEventConnection = clickEvent.OnServerEvent:connect(onClick)
end
local function onUnequip()
clickEventConnection:disconnect()
end
tool.Equipped:connect(onEquip)
tool.Unequipped:connect(onUnequip)
Here is the LocalScript:
-- Local Script
local tool = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local clickEvent = tool.ClickEvent
local function onActivate()
local clickLocation = mouse.Hit
clickEvent:FireServer(clickLocation)
end
tool.Activated:connect(onActivate)
