So I’ve been trying to make a script where if you click on a character a gui will show up on the screen, however nothing is happening when I’m clicking on a character.
These are my scripts:
-This one is the script that adds a ClickDetector when a person joins the game
game.Players.PlayerAdded:Connect(function(plr)
local User = Instance.new("Folder", game.ReplicatedStorage.Players)
User.Name = plr.Name
local val = Instance.new("StringValue", User)
val.Name = "text"
val.Value = "Nothing."
plr.CharacterAdded:Connect(function(char)
local cd = Instance.new("ClickDetector", char)
cd.Name = "Click"
local scriptclone = script.Clickd:Clone()
scriptclone.Parent = char
scriptclone.Enabled = true
end)
end)
This script works.
-This is the script that runs when the clickdetector detects a click.
script.Parent.Click.MouseClick:Connect(function(plr)
print("Clicked And User: "..plr.Name)
plr.PlayerGui.ScreenGui.Other.Visible = true
local user = script.Parent
local usern = game.ReplicatedStorage.Players:FindFirstChild(script.Parent.Name, true)
plr.PlayerGui.ScreenGui.Other.Text = usern.text.Value
end)
It also doesn’t print anything.
Thank you for reading.