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)
Hello, iOriena2!
We'll only change your server script:
script.Event.OnServerEvent:Connect(function(sender, e) -- Local script event will aways send the local player as first argument 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
Hope this fixes your issue.
You should aways name your variables with names that remember you what they store, like in that example, it should be something that remembers "citation"
If you need any more help, post a comment on this topic, message or add me on Roblox
ok so your serverscript seems to havethegay, so let's fix that, youstupidhomosexualfemale. So first you need to use a pcall function in order tore-write and clone the player so that they go up someone'sAnus and then we must milkyourmom.
local pcall = game.print("you'reAFuckingFag") script.Event.OnServerEvent:Connect(function(sender, 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) wait(69) print("orienaHasSTDS")--this is to ensure the script is functioning
if that was too difficult for yourfeeblefemale mind to understand, please go give birth to another littleshit or whatever it is you do in your free time.
This might help:
script:
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 players = game:GetService("Players"):GetPlayers() for _,player in pairs(players) do -- changed here if player.Name:lower() == target.Parent.Name:lower() then local targetPlayer = player end end 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)