Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I access a local player through ClickDetector Click function?

Asked by 7 years ago

This is my script

local TextString = script.Parent.Parent:WaitForChild("TextString1").Value
local AddedString = script.Parent.Parent:WaitForChild("AddedString").Value
local ErrorString = script.Parent.Parent:WaitForChild("ErrorString").Value
local YesNoGui = game.ReplicatedStorage:WaitForChild("YesNoGui")
local YesButton = YesNoGui.YesButton
local NoButton = YesNoGui.NoButton
local Length = string.len(TextString,AddedString,ErrorString)
local TalkGui = game.ReplicatedStorage:WaitForChild("TalkGui")
local TextDisplayer = TalkGui:WaitForChild("ChatBubble")
local Clicker = script.Parent

Clicker.mouseClick:connect(function(Clicked)
    wait()
    local CloneTalkGui = TalkGui:Clone()
    CloneTalkGui.Parent = Clicked.Parent.PlayerGui
    print("TalkGui been cloned!")
    for i = 1,Length do
        wait()
        TextDisplayer.Text = string.sub(TextString,1,i)
        wait(5)
        local CloneYesNoGui = YesNoGui:Clone()
        CloneYesNoGui.Parent = Clicked.Parent.PlayerGui
        print("YesNoGui Cloned!")
    end
end)

Error Part In Output:

14:33:08.748 - PlayerGui is not a valid member of Players
14:33:08.751 - Stack Begin
14:33:08.753 - Script 'Workspace.ClickGiver.ClickDetector.Script', Line 15
14:33:08.755 - Stack End

My Entire Output:

14:32:47.767 - [Development] Button Clicker was auto-saved (x5)
Ragdoll Physics Loaded
Hello world!
14:32:54.317 - Humanoid is not a valid member of Script
14:32:54.320 - Stack Begin
14:32:54.331 - Script 'Plugin_144773946.RealRagdoll.Ragdoll', Line 4
14:32:54.333 - Stack End
Loading Cutscene Editor...
Bouyer's Ragdoll Physics Loaded
Finished Loading.
Loading Tree Gen...
Finished Loading Tree Gen
14:32:57.967 - Unable to load plugin icon. (x2)
14:32:58.319 - GetGroupsAsync is not a valid member of Player
14:32:58.322 - Stack Begin
14:32:58.325 - Script 'Workspace.Rank', Line 9
14:32:58.326 - Stack End
14:32:59.149 - TestService: Shop plugin by UltraWorks is outdated. Please click the 'Manage Plugins' button and update to the latest version.
    This version: [2.1.6]
    Please update to: [2.1.7]
Realism Mod is running on v1.795!
Cutscene Editor Loaded
stat numba 1 has been found
stat numba 2 has been found
stat numba 3 has been found
Hello world!
14:33:08.748 - PlayerGui is not a valid member of Players
14:33:08.751 - Stack Begin
14:33:08.753 - Script 'Workspace.ClickGiver.ClickDetector.Script', Line 15
14:33:08.755 - Stack End
14:33:09.170 - PlayerGui is not a valid member of Players
14:33:09.172 - Stack Begin
14:33:09.174 - Script 'Workspace.ClickGiver.ClickDetector.Script', Line 15
14:33:09.176 - Stack End
14:33:14.239 - PlayerGui is not a valid member of Players
14:33:14.246 - Stack Begin
14:33:14.248 - Script 'Workspace.ClickGiver.ClickDetector.Script', Line 15
14:33:14.250 - Stack End
saved data number 1
saved data number 2
saved data number 3
Stats successfully saved
14:35:22.952 - [Development] Button Clicker was auto-saved

Please help! I'm trying to access a local player but it went to players instead, how would I fix this? What is my problem?

1 answer

Log in to vote
-1
Answered by 7 years ago

You cant access the playergui from a serverside script, I suggest using remote functions/events.

Ad

Answer this question