Im trying to make the pls donate jar like in this game, get paid to vibe - Roblox however im confused on how to allow other players to click on your tool, how would i be able to do this?
Use a ClickDetector. It has a parameter of who clicked it, so you can prompt them to purchase something.
Whats the property called? (300characters)
It is not a property, it is a parameter of the .MouseClick function on the clickdetector.
Oh alright got it (300characters0
True,
You use .MouseClick
on a ClickDetetcor
Example:
CD.MouseClick:Connect(function(player) -- Function / Gets The Player who Clicked
print(player.Name) -- Test
end)
Do i have to use a remoteveent or something? Tried it and it just errors when i try to open a UI, doing it in a serverscript btw
Its probably better if you do, try using WaitForChild
tho.
For some reason the UI doesnt open, even though im on a local script
local tool = script.Parent
local cd = tool:WaitForChild("ClickDetector")
cd.MouseClick:Connect(function(player)
game.StarterGui.Donate.Frame.Visible = true
end)
![image|469x166](upload://otzxbIraFNayzmdPTGq1CfrFeoV.png)
You need to make sure that you’re changing the PlayerGui, not the StarterGui, that is basically a storage for UIs and when a player joins the game, everything in StarterGui is copied into the PlayerGui:
local tool = script.Parent
local cd = tool:WaitForChild("ClickDetector")
cd.MouseClick:Connect(function(player)
player.PlayerGui.Donate.Frame.Visible = true
end)
This should be working as long as the script is on the client, if it is on the server, then the practical way is to use a remote event, but you could also do it the same way.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.