Hello! So I am making a part that if you touch it, it will fire a client. I want it to show a gui for that player who touched it. It seems that the first script works but the gui script doesn’t.
First Script
local badgeService = game:GetService("BadgeService")
local badge = 2129022874
script.Parent.Touched:Connect(function(partB)
local humanoid = partB.Parent:FindFirstChild("Humanoid")
if humanoid then
local player = game.Players:GetPlayerFromCharacter(partB.Parent)
game.ReplicatedStorage.Voiceline:FireClient(player)
local hasBadge = badgeService:UserHasBadgeAsync(player.UserId, badge)
if hasBadge then
--player has badge
else
badgeService:AwardBadge(player.UserId, badge)
print("Worked")
end
end
end)
Second LocalScript
while wait(0.1) do
if script.Parent.ImageLabel.Visible == true then
script.Parent.Glitch:Play()
script.Parent.ImageLabel.Visible = true
game.Lighting.Ambient = Color3.new(1, 0, 0)
wait(2)
script.Parent.Glitch:Stop()
script.Parent.ImageLabel.Visible = false
end
end
game.ReplicatedStorage.Voiceline.OnClientEvent:Connect(function()
print("touched")
game.Workspace.Map.GlitchPart:Destroy()
script.Parent.ImageLabel.Visible = true
script.Parent.Sound:Play()
script.Parent.VoiceLine:Play()
wait(1)
script.Parent.TextLabel.Visible = true
wait(3)
script.Parent.TextLabel.Visible = false
game.Lighting.Ambient = Color3.new(0, 0, 0)
end)