I have a problem with the remote event. I wanted to re-make a owner only door, but got an problem. when the player passes the "test" that he's owner, then I fire his client by RemoteEvent. But nothing happends. There are 2 scripts
"Script"(location: workspace["Owner Only Door"].Door)
script.Parent.Touched:Connect(function(player)
if player.UserId == game.CreatorId then
game.ReplicatedStorage.TestPassed:FireClient(player)
end
end)
And "LocalScript"(location: game.StarterPlayer.StarterPlayerScripts)
game.ReplicatedStorage.TestPassed.OnClientEvent:Connect(function()
workspace["Owner Only Door"].Door.Transparency = 0.5
workspace["Owner Only Door"].Door.CanCollide = false
end)
Your mistake there is touched does not save player, it actually saves body part that touched it
so what you need to do is check whether or not if its player touching it, then get player and then compare whether it's owner or just some random player
--SERVERSCRIPT script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local player = game.Players[hit.Parent.Name] if player.UserId == game.CreatorId then game.ReplicatedStorage.TestPassed:FireClient(player) end end end) --LOCALSCRIPT game.ReplicatedStorage.TestPassed.OnClientEvent:Connect(function() workspace["Owner Only Door"].Door.Transparency = 0.5 workspace["Owner Only Door"].Door.CanCollide = false end)
I am sorry if there are any errors, I have not checked the code
hey you! have you ever heard of enes? if you are in trouble, better call enes!