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

Why Does My Remote Event Script Not Work Properly?

Asked by 4 years ago

I have a script which is supposed to change a text box's text depending on what block you touch but it isn't working there are no errors in the output bar and nothing seems wrong can you help me fix this?

first script (changing text)

local Next = script.Parent -- text box
local tookoff = game.ReplicatedStorage.TAKEOFF -- remote event 1
local landed = game.ReplicatedStorage.LAND -- remote event 2

tookoff.OnClientEvent:Connect(function() -- check for event fire
    print("took off") -- print text
    Next.Text = "Next Plane In" -- change text
end)
landed.OnClientEvent:Connect(function() -- check for event fire
    print("landed") -- print text
    Next.Text = "Plane Taking Off In"-- change text
end)

first remote event

script.Parent.Touched:Connect(function(hit) -- touch
    if hit.Parent:FindFirstChild("Humanoid") then -- check for humanoid 
        local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- set player
        game.ReplicatedStorage.TAKEOFF:FireClient(player) -- fire event
    end
end)

second remote event

script.Parent.Touched:Connect(function(hit) -- touch
    if hit.Parent:FindFirstChild("Humanoid") then-- check for humanoid 
        local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- set player
        game.ReplicatedStorage.LAND:FireClient(player)-- fire event
    end
end)

Answer this question