game.Players.PlayerAdded:Connect(function(player)
local timeValue = Instance.new("IntValue")
timeValue.Name = "Time"
timeValue.Value = 0
timeValue.Parent = player
while wait(1) do
timeValue.Value = timeValue.Value + 1
if timeValue.Value == 10 then
game.ReplicatedStorage.FirePoorPersonCutscene:FireAllClients(player)
end
end
end)```
#Why wont this work?
130 messages · Page 1 of 1 (latest)
It should 100% work
is it a local script lmao
Judging the fact hes used player added I higly doubt it is
just incase
it allways happens
are u still having problems?
The provided script listens for new players joining the game and creates a new IntValue named "Time" for each player. It then increments the value of "Time" every second until it reaches 10, at which point it fires a cutscene for the player using a replicated event. However, there are a few improvements that can be made to the script:
The script currently uses an infinite while wait(1) do loop, which can potentially cause performance issues. Instead, you can use a RunService.Heartbeat connection to update the time value every frame.
The script uses game.ReplicatedStorage.FirePoorPersonCutscene:FireAllClients(player) to fire the cutscene for the player. It's unclear what this event does, so please make sure that it is implemented correctly on the server and that the clients are listening for it.
** You are now Level 6! **
here is the new and fixed version
local Players = game:GetService("Players")
local function updateTime(player)
local timeValue = Instance.new("IntValue")
timeValue.Name = "Time"
timeValue.Value = 0
timeValue.Parent = player
local function updateValue()
timeValue.Value = timeValue.Value + 1
if timeValue.Value == 10 then
game.ReplicatedStorage.FirePoorPersonCutscene:FireAllClients(player)
end
end
game:GetService("RunService").Heartbeat:Connect(updateValue)
end
Players.PlayerAdded:Connect(updateTime)
@toxic venture
@flat trench
sorry for the ping dark
it was on accident
Ur chill
yes its a local script
@flat trench
Dont use playeradded on local scripts
Local scripts start running when the player joins
Idk if this is a dumb suggestion but maybe create the time variables and update them on the server?
Idk if remote events fired from a client can fire a client, but im new to scripting so idk
If you create something on a local script it will stay on the client
So your time thing will only stay on the client
Sorry I couldn't talk
@toxic venture i fucking told uu
remote event is from client to server
remote event is client to server
what is client to server
ok
to talk server to server its a bindable event
Told me what lmao, I thought it would be a script because he used player added. Dont get too cocky now 🫣
** You are now Level 5! **
No it can be a script
ok
Send the code
.
I think you use likeservwe
Server
In your case
Although im not sure because I only just came here
olr
** You are now Level 7! **
cause ur tryna talk from server to server, with a thing that talks from client to server
local script?
....
what do i need to do
learn to script
he said he doesnt know...
hmmmmm
Right
So
Sebd the script that happens when the event is triggered
And make sure it is a local script in starterplayerscripts
ok
there are multiple
but the main one
What did you thrn into a local script
Script:
local Players = game:GetService("Players")
function giveTime(player)
while wait(1) do
player.Time.Value += 1
if player.Time.Value == 10 then
game.ReplicatedStorage.FirePoorPersonCutscene:FireAllClients()
end
end
end
Players.PlayerAdded:Connect(function(player)
local TimeV = Instance.new("IntValue")
TimeV.Name = "Time"
TimeV.Value = 0
TimeV.Parent = Players
giveTime(player)
end)
Local script:
game.ReplicatedStorage.PoorPersonCutscene.OnClientEvent:Connect(function()
--Cutscene code
end)
Use a remote event btw
There
wher do i put them
I think its onserverevent
Oh mb thought it was a client
no
does it work?
i didint try it yet 1 sec
k
the value time never gets any value
nvm
it adds in increments of 2
wait its bc i have my other script running
nvm it still deos
does
many errors
i ran it a few times
@tribal condor
r u there?
@toxic venture
btw the sound id is for smth else
none of thse errors have to do with the script i gave u
ok
@flat trench what was ur problem or is it solved?
iits not solved