||Straightforward||

I'm new to Remote Events(first time) and I thought I did it right, but it isn't working?

Client Script (inside a folder in replicated storage)


local player = game.Players.LocalPlayer
local RemoteEvent = game:GetService("ReplicatedStorage").Miscellaneous.SendUnlockToPortal

repeat wait() until player:WaitForChild("PlayerHasCodes",1).Value == true -- waits for value inside player (I know it is a bad idea, but I honestly have no care in the world)

RemoteEvent:FireServer()

Server Script (inside workspace>model>model>part)

local RemoteEvent = game:GetService("ReplicatedStorage").Miscellaneous.SendUnlockToPortal

local function REfunction(player)
	print("REMOTE EVENT WORKED")
	print(player.Name)
	script.Parent.Transparency = 0
	script.Parent.ParticleEmitter.Transparency = 0
	wait(1)
	player:WaitForChild("PlayerHasCodes",1).Value = false
end

RemoteEvent.OnServerEvent:Connect(REfunction)

2 comments

1

Why is the client script in replicated? Its parent has to be linked with the player (inside the character, backpack, playergui, playerscripts) for it to identify the LocalPlayer

0

Wow.. can't believe that was all that was stopping it from working... That sucks man. Thanks a lot!