local function getPlayerFromCharacter(character)
for _, player in pairs(game:GetService("Players"):GetPlayers()) do
if player.Character == character then
return player
end
end
end
function onTouched(part)
if part.Parent:findFirstChild("Humanoid")~=nil then
print("humanoid touched")
local char = part.Parent:findFirstChild("Humanoid").Parent
getPlayerFromCharacter(char)
local player = getPlayerFromCharacter(char)
local plrgui = player.PlayerGui:FindFirstChild("PlayerGui")
game.ReplicatedStorage.RemoteEvent:FireClient(player)
print("fired")
end
end
script.Parent.Touched:connect(onTouched)
The script above succesfully prints everything it should once touched.
Although the LocalScript below me does nothing
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(player)
print("received")
player.PlayerGui.bacteria.Enabled = true
local text = player.PlayerGui.bacteria.TextLabel.Text
text = "Y"
wait()
text = "Yo"
wait()
text = "You"
wait()
text = "You h"
wait()
text = "You ha"
wait()
text = "You hav"
wait()
text = "You have"
wait()
print("changed to you have")
end)
