Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[SOLVED!]I'm making a tool giver gui, but the tool doesn't work in a local script. How do I do this?

So I'm making a tool giver gui, but I can't seem to find a way to locate the LocalPlayer in a server script. I've seen many people have this problem, but in different situations that don't match mines. The tutorials on YouTube also use LocalScripts, and as they do work, I'm pretty sure other players don't see the tools you are using. Here is my code:

script.Parent.MouseButton1Down:Connect(function()
	local tool = game.Lighting.Tool:Clone()
	tool.Parent = --???????
end)

I have read the Roblox Developer Hub article about GuiObjects and the MouseButton1Down event, but I can't seem to find the solution. Please help me, as this could help others in the future having this same problem.

3 comments

0

Try accessing the player from script.Parent.Parent and so on until u reach the player

0

don't use ""script..Parent..Parent"" Use ""script:FindFirstAncestorOfClass("Player")""

0

Yo thanks guys! It actually worked! :D

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.