I came up with a script that fires an event for the client, (fireclient) from the server, that is fired once a player touches a part.
it does work, but it actually fires 10-15 times for as long as the player is on the part (in contact)
Here is the script I used in the part
local players = game:GetService("Players")
local stepped = false
if stepped == true then stepped = false wait(1) else wait(1.1)
script.Parent.Touched:Connect(function(hit)
local touchedPlayer = players:GetPlayerFromCharacter(hit.Parent)
if touchedPlayer then
for _, loopedPlayer in pairs(players:GetPlayers()) do
coroutine.wrap(function()
wait(1)
local event = game.ReplicatedStorage.CompleteEvent
event:FireClient(touchedPlayer)
for _, loopedPlayer in pairs(players:GetPlayers()) do
if loopedPlayer:FindFirstChild("PlayerGui") then
local Complete = loopedPlayer.PlayerGui.ScreenGui.complete
Complete.Visible = true
Complete.Text = "Wow !" .. touchedPlayer.Name .. " has climbed the Un-Climbable Stairs !"
wait(3.3)
Complete.Visible = false
stepped=true
end
end
end)()
end
end
end)
end
Basically if there is a folder called folder2, containing the bool âcompletedâ , if that is found in the folder , and it is true, then nothing happens at all, but if the value is false then a gui is shown , and the value is set to true, so that we know he has completed .
My script in StarterPlayerScripts//local script
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = Players.LocalPlayer
local event = ReplicatedStorage:WaitForChild("CompleteEvent")
event.OnClientEvent:Connect(function(player)
wait(0.8)
if player.folder2.completed.Value == true then
return print("already true")
end
wait(0.7)
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 100
print("added")
player.folder2.completed.Value = true
print("value set to true, you have received the cash")
end)