Hello. You have to use RemoteEvents
. They are used for client (player) and server communication. First, insert a RemoteEvent
in ReplicatedStorage
and call it "BoolTrueEvent". Now the part of your LocalScript
to this:
1 | elseif game.ReplicatedStorage.ClockTimeValue.Value ~ = 6 and game.ReplicatedStorage.Stig.Value = = true then |
2 | game.Lighting.StigForeverJumpScare.Parent = game.Workspace |
3 | game.ReplicatedStorage.BoolTrueEvent:FireServer() |
4 | print ( "time for jumpscare" ) |
This will fire the RemoteEvent
for the server. Now, insert a Script
into ServerScriptService
or Workspace
. Write the following code:
1 | game.ReplicatedStorage:WaitForChild( "BoolTrueEvent" ).OnServerEvent:Connect( function (player) |
2 | game.ReplicatedStorage.JumpscareTime.Value = true |
The event will fire whenever the "BoolTrueEvent" fires, which it did in the LocalScript
. Also, you automatically get the player who fired that event as a parameter of the OnServerEvent
event. Please upvote and accept this answer if it helped.