Henlo. :3 What I'm trying to do is give a player through a remoteevent, which I know how to do, but it doesn't seem to be working correctly. The remoteevent, localscript and script are in the backpack of the player, which shouldn't be an issue either.
Here's the script for the localscript:
plr = game.Players.LocalPlayer
mouse = plr:GetMouse()
tool = script.Parent
equipped = false
active = false
tool.Equipped:connect(function()
equipped = true
mouse.Button1Down:connect(function()
if equipped and not active then
local target = mouse.Target
if target.Parent:FindFirstChild("Humanoid") then
active = true
local targetPlayer = game.Players:FindFirstChild(target.Parent.Name)
local newUI = script:WaitForChild("CitationGUI_Officer"):Clone()
newUI.Main.Title.Convicted.Text = "Convicted: " ..targetPlayer.Name
newUI.Parent = plr.PlayerGui
newUI.Main.Actions:WaitForChild("Submit").MouseButton1Down:connect(function()
if newUI.Main.Reason:WaitForChild("TextBox").Text ~= "" then
script.CitiaionGiver.Event:FireServer(targetPlayer)
newUI:Destroy()
active = false
else
end
end)
newUI.Main:WaitForChild("IconCloseButton").MouseButton1Down:connect(function()
newUI:Destroy()
active = false
end)
end
end
end)
end)
tool.Unequipped:connect(function()
equipped = false
end)
And the script for the script:
script.Event.OnServerEvent:Connect(function(e)
script.TargetName.Value = e.Name
local PnewUI = script.Parent:WaitForChild("CitationGUI_Player"):Clone()
PnewUI.Main.Title.Convicted.Text = "By: " ..script.TargetName.Value
PnewUI.Parent = game.Players[script.TargetName.Value].PlayerGui
PnewUI.Enabled = true
end) --I'm using a stringvalue because passing the player through normally didn't seem to work, I don't plan for it to stay like this :P
Sorry if this is a basic question, any help is appreciated! ^w^
(but if you need some context, what I'm trying to make is a citation notepad where you can cite people, the gui for the player works fine but giving the "you've been cited" message seems to just give it to the player who has the notepad, which it isn't meant to do, if you could find another way to give the gui that would work too :3)

2 comments
What script doesnt work local or server script. And what line does it not work?
I'm pretty sure it's the server script, it gives the gui to the wrong player. And to reiterate the script works, but not in an intended way. "but what I'm trying to make is a citation notepad where you can cite people, the gui for the player works fine but clicking the "submit" button seems to just give it to the player who has the notepad, which it isn't meant to do."