Why is this script not working?

Im making a gun system, and in this script for it isnt working, it doesnt shows any errors in output and i dont know what i am doing wrong

Could anyone help me?

The script

local tool = script.Parent
local shoot_part = tool:WaitForChild("FirePart")

local Workspace = game:GetService("Workspace")
local ServerStorage = game:GetService("ServerStorage")
local Attaches = game.ServerStorage:WaitForChild("Shoot")

local origin = shoot_part.Position
local player = game.Players.LocalPlayer

local mouse = player:GetMouse()
script.Parent.Activated:Connect(function()
	local targetPart = mouse.Target
	if targetPart:WaitForChild("Humanoid") then
		local hu = targetPart:WaitForChild("HumanoidRootPart")
		Attaches:Clone().Parent = game.Workspace
		local bullet = game.Workspace.Shoot
		bullet.Attach1.Position = shoot_part.Position
		bullet.Attach2.Position = hu.Position
	end
end)

If you’re using a local script; you can’t acces serverstorage from those. If you are using a serverscript: you can’t access localplayer from those.

but can i acess replicated storage from a local script?
if yes then its only changing it to replicated storage right?

ReplicatedStorage is replicated to both Client and Server. Also you can’t clone from a local script, neither can you change postions. Make both a local and server script and let them communicate by remoteevents in the ReplicatedStorage.

so that means i would change the whole script.Parent.Activated function to fire a remote event and move the current function to a server script right?

Yes, and you would pass stuff like the player name and mouse target through the event.

oh ok thx!

Message has no 30 letters

ServerStorage is restricted to be accessed from server scripts only.

game.Players.LocalPlayer

Is only defined in local scripts (is nil in server scripts). You’ll need to get the local player’s object in some other way.