I am currently wondering why is a LocalScript working perfectly in Studio, but does nothing in the game itself.
The LocalScript itself:
lp = script.Parent local debounce = false function onButton1Down(mouse) if not debounce then debounce = true local grenade = game.ServerStorage:WaitForChild("Grenade") local model = grenade:clone() model.Parent = game.Workspace model = game.Workspace:WaitForChild("Grenade") model.PrimaryPart = model.Union model:MakeJoints() model:MoveTo(mouse.hit.p) local cframe = model.PrimaryPart.CFrame model:SetPrimaryPartCFrame(cframe * CFrame.fromEulerAnglesXYZ(math.random(0,359), math.random(0,359), math.random(0,359))) wait(5) debounce = false end end function onEquipped(mouse) mouse.Button1Down:connect(function() onButton1Down(mouse) end) end lp.Equipped:connect(onEquipped)
The Script is in a Tool and it is supposed to clone a Model called Grenade from ServerStorage to Workspace where the mouse cursor is.
It works without any problems in ROBLOX Studio. However, when I join the game and use the Tool, it does nothing when I click.
As you can see, it is a LocalScript and there is WaitForChild here. It still works perfectly in ROBLOX Studio, but not in the game.
I kindly request your help and advice, fellow scripters.
It being Fe or Non-FE aside i have made a Non-FE Demo that can be Edited and Researched thru
So what i've done is Placed the Grenade Model into game:GetService("ReplicatedStorage")
I don't know why it worked that time but its probably because i didn't mind to change it
And since its a Local Script we can indeed use :GetMouse()
local Player_Variable_Name_Here = game:GetService("Players").LocalPlayer:GetMouse() to be Exact
Mouse.Button1Down:connect(function() end) instead
The game works online and in studio probably because its non-fe but heres the Tools API and help for making a FE game with Tools