Hello!

I am currently trying to make a GUI the allows you to change the toolgrip of your current held tool. I am getting this strange error that I have never occurred before and be researching other people's problems with this occurrence and I couldn't find one similar to my own case. Could someone please help?

Server:

game.ReplicatedStorage.Raised.OnServerEvent:Connect(function(player, toolname)
	print(toolname)
	player.Character[toolname].GripUp = Vector3.new(-0.194, 0.976, -0.101)
	player.Character[toolname].GripForward = Vector3.new(0.979, 0.199, 0.042)
	player.Character[toolname].GripRight = Vector3.new(-0.061, 0.091, 0.994)
	player.Character[toolname].GripPos = Vector3.new(-0.4, 0, 0)
end)

Client:

script.Parent.MouseButton1Click:Connect(function()
	local player = script.Parent.Parent.Parent.Parent
	local toolname = player.Character:FindFirstChildOfClass("Tool")
	if not toolname then
	player.Character.ChildAdded:wait()
	game.ReplicatedStorage.Shoulder:FireServer(toolname.Name)
	end
end)

Help appreciated!

6 comments

0

What line and in what script does the error occur?

0

The ServerSide script at lines 2-6

0

You're only firing the event on line 6 if the tool doesn't exist, so toolname.Name is a nil value

0

But I have it set for the GUI to only be enabled if the tool is equipped.

0

Did you mean to write "if toolname then" on line 4, instead of "if not toolname then"?

0

Yes