function myfunction()
game.ServerStorage.Bullet:Clone() game.ServerStorage.Clone = game.Workspace script.Parent.fire:Play() end script.Parent.ClickDetector.MouseClick:connect(myfunction)
Edit:problem fixed.
You need to put the clone under a variable in order for it to work. Here's how you do it.
1 | local bullet = game.ServerStorage.Bullet |
2 | local bulletClone = bullet:Clone() |
3 | bulletClone.Parent = game.Workspace |
4 | --the rest of your code goes here |
I hope that helped.
you need to set the parent of the clone to the workspace therefore you will need to do it like this
1 | local ServerStorage = game:GetService( "ServerStorage" ) |
2 |
3 | local function myfunction() |
4 | local bulletShot = ServerStorage.Bullet:Clone() |
5 | bulletShot.Parent = game.Workspace |
6 | script.Parent.fire:Play() |
7 | end ) |
8 |
9 | script.Parent.ClickDetector.MouseButton 1 Click:Connect(myfunction) |
I think this would work. If not i'm sorry i'm not extremely experienced. If it does please make this question answered