Hi! So I have this gui and I want to control the visibility of it (not with .Visible
but :TweenPosition()
). ’
How it works: When a player touches a part, a gui comes from the corner telling them what they receive.
Problem: FireClient()
and FireAllClients()
work differently (I’m trying to use FireClient()
because only the player who touched the part should see it).
Scripts:
Local script in gui:
game.ReplicatedStorage:WaitForChild("Received").OnClientEvent:Connect(function(visible)
if visible == true then
game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel:TweenPosition(UDim2.new(0.842, 0, 0.44, 0))
else
if visible == false then
game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel:TweenPosition(UDim2.new(1.2, 0, 0.44, 0))
end
end
end)
Regular script in part:
local clientEvent = game.ReplicatedStorage:WaitForChild("Received")
function onTouched(m)
local p = m.Parent:FindFirstChild("Humanoid")
if p ~= nil then
p.Torso.CFrame = CFrame.new(34.25, 1.5, 2685.5) --Change the numbers here to the position you want the humanoid to teleport to.
clientEvent:FireClient(true)
wait(5)
clientEvent:FireClient(false)
end
end
script.Parent.Touched:connect(onTouched)
When I use FireAllClients()
, it works perfectly but with FireClient()
, here’s the error I get:
Got any suggestions on how I can fix this issue?