Randomly my gun server script doesn’t work any help?
(These scripts duplicate my gun.) (The serverscript worked fine until I used these scripts to duplicate the guns)
local script
local Event = game:GetService("ReplicatedStorage"):WaitForChild("GiveGun")
local name = script.Parent.Name
script.Parent.MouseButton1Down:Connect(function()
Event:FireServer(name)
script.Parent.Parent.Visible = false
end)
server script
local Event = game:GetService("ReplicatedStorage"):WaitForChild("GiveGun")
Event.OnServerEvent:Connect(function(player, name)
local character = player.Character
local Clone = game.Workspace:WaitForChild("Guns"):FindFirstChild(name):Clone()
Clone.Parent = character
Clone.Handle.Anchored = false
end)
These scripts clone the gun but the server script doesent work on the gun anymore? any help?
try to print on both of the functions and see if they run. If they don’t then reply back.
local Event = game:GetService("ReplicatedStorage"):WaitForChild("GiveGun")
Event.OnServerEvent:Connect(function(player, name)
print("Success")
local character = player.Character
local Clone = game.Workspace:WaitForChild("Guns"):FindFirstChild(name):Clone()
Clone.Parent = character
Clone.Handle.Anchored = false
end)
And
local Event = game:GetService("ReplicatedStorage"):WaitForChild("GiveGun")
local name = script.Parent.Name
script.Parent.MouseButton1Down:Connect(function()
print("Success2")
Event:FireServer(name)
script.Parent.Parent.Visible = false
end)