Remote events not giving tool to player

The goal of my script is to give the player a tool when they click on a GUI. When using these scripts the FireServer event doesn’t seem to be getting received by the server. I used print statements in both scripts and it only printed the message inside the localscript. I have tried making the remote event more clear and using GetService(“ReplicatedStorage”) instead of referring to it as game.ReplicatedStorage to see if it just wasn’t finding the remote event but it hasn’t worked. Does anyone have any idea what the issue could be?

LocalScript (inside starterGUI)

local player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RM = game:GetService("ReplicatedStorage"):WaitForChild("ToolGiver")

script.Parent.MouseButton1Down:Connect(function()
	RM:FireServer(player, "Wood")
end)

Script (Server Script Service)

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RM = game:GetService("ReplicatedStorage"):WaitForChild("ToolGiver")

RM.OnServerEvent:Connect(function(plr, weapontype)
	if weapontype == "Wood" then
		local weaponclone = game.ReplicatedStorage["Wooden Sword"]:Clone()
		weaponclone.Parent = plr.Backpack
	end
end)

2 Likes
script.Parent.MouseButton1Down:Connect(function()
	RM:FireServer("Wood")
end)

Please do this instead, there’s already a player on the first argument during OnServerEvent.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.