The current issue I am dealing with is trying to get my GUI to change. I currently am making a character changing system, so if the character is pressed, or morphed into, the text and text color will change. The issue with this currently is that I am trying to get the Character off of the server script, which is a touched event, and it goes successful until the game begins to try and see if the PlayerGUI exists.
The issue comes in that the server will be unable to find the PlayerGUI, but the whole thing is that I don’t really know any other methods in which I could be able to change the GUI text for the character within the touched event. Along with that, placing the same serverscript in a local script yields in no actual script working.
-- \\ GetService Variables // --
local RS = game:GetService("ReplicatedStorage")
local Event = RS.CharChosen.CharacterSelected
local CSM = require(RS.Modules.CharacterModule)
local MM = require(RS.Modules.MainModule)
-- \\ Functions // --
thegreatest = script.Parent.Touched:connect(function(hit)
if not hit.Parent:FindFirstChild("Humanoid") then return end
if hit.Parent:FindFirstChild("Humanoid") then
local Hum = hit.Parent:FindFirstChild("Humanoid")
local d = hit.Parent:GetChildren()
for i=1, #d do
if (d[i].ClassName == "Decal") then
d[i]:Remove()
end
end
hit.Parent:SetAttribute("CharaChosen", "Fire")
if hit.Parent:GetAttribute("CharaChosen") == "Fire" then
CC = hit.Parent:FindFirstChild("ChosenCharacter")
MM:AddValues(CC, "BoolValue", "Fire", math.huge)
end
Hum:ApplyDescription(script.Parent.HumanoidDescription)
CSM.CharacterSetter(hit.Parent, CC)
thegreatest:Disconnect()
end
end)
SeverScript Above ^
local CharacterModule = {
Fire = {
["Fire Punch"] = 1,
["Spin-Kick"] = 2,
["Rapid Explosion"] = 3,
["Flailing Fire Kick"] = 4,
["Final".. ":" .."Hell has Called."] = 5
},
Lightning = {
["Shocker's Pass"] = 1,
["Thunder's Anger"] = 2,
["Zsst!"] = 3,
["Elbow Beat-Up"] = 4,
["Final".. ":" .."Discharge, the GigaJoule x 100 "] = 5,
},
}
function CharacterModule.CharacterSetter(Character, CharacterPicked)
print(Character)
local Players = game:GetService("Players")
local Player = Players:GetPlayerFromCharacter(Character)
print(Player)
local CharaFire = CharacterModule.Fire
if CharacterPicked:FindFirstChild("Fire") then
print("TAHHHHH")
Player:WaitForChild("PlayerGUI"):FindFirstChild("MoveScreen").Move1.Move1Name.Text = CharaFire[1]
Player:WaitForChild("PlayerGUI"):FindFirstChild("MoveScreen").Move2.Move2Name.Text = CharaFire[2]
Player:WaitForChild("PlayerGUI"):FindFirstChild("MoveScreen").Move3.Move3Name.Text = CharaFire[3]
Player:WaitForChild("PlayerGUI"):FindFirstChild("MoveScreen").Move4.Move4Name.Text = CharaFire[4]
Player:WaitForChild("PlayerGUI"):FindFirstChild("MoveScreen").Move1.Move1Indicator.BackgroundColor3 = Color3.new(1, 0.113725, 0.113725)
Player:WaitForChild("PlayerGUI"):FindFirstChild("MoveScreen").Move2.Move2Indicator.BackgroundColor3 = Color3.new(1, 0.113725, 0.113725)
Player:WaitForChild("PlayerGUI"):FindFirstChild("MoveScreen").Move3.Move3Indicator.BackgroundColor3 = Color3.new(1, 0.113725, 0.113725)
Player:WaitForChild("PlayerGUI"):FindFirstChild("MoveScreen").Move4.Move4Indicator.BackgroundColor3 = Color3.new(1, 0.113725, 0.113725)
end
end
return CharacterModule
ModuleScript Above ^
The error I continue to get is
And, it continues to loop even though I’m trying to attempt it to stop if it doesn’t find a Hit.Parent with a Humanoid.
And yes, all the prints do work
Also, my apologies if this post feels rushed, that’s because it is. I’m currently getting ready to leave for practice so, yeah.