Well I'm taking an educated guess and saying this is a LocalScript because you are getting the LocalPlayer from players. If so you cannot access ServerStorage from a LocalScript. Because of this you'll need to use both a LocalScript and a Script to get this done. First Create a LocalScript, a Script, and a RemoteEvent, ideally in the same Parent so we can get to it easily.
Let's start on the LocalScript, first we create an activated event, guessing that parent is a tool.
When this event fires we will fire the remoteevent and send over the mouse hit
local mouse = game.Players.LocalPlayer:GetMouse()
local re = script.Parent.RemoteEvent
script.Parent.Activated:connect(function()
re:FireServer(mouse.Hit)
end)
Now inside the Script we will create the event for the remoteevent and then clone the bullet
local re = script.Parent.RemoteEvent
re.OnServerEvent:connect(function(plr,hit)
local bullet = game.ServerStorage.Bullet:Clone()
bullet.Parent=workspace
bullet.CFrame=hit
end)
Now in your script you had a few problems, but two of them were that you were not assigning the bullet's clone to a variable and that you were setting the bullet instance inside serverstorage aka the original instance's parent instead of the clone, also the same with the cframe
Also you don't do mouse.hit, it's mouse.Hit, ;p
3 comments
Please format your code and put it into a code block.
you should define them as variables, like local bullet = game.ServerStorage.Bullet:Clone(). Then set the Parent and CFrame using
bullet.can you format it into a code block or put each line of code on a seperate line