Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

RPG Level Door Suddenly only works in Solo?

Asked by 7 years ago

Ive been making an RPG game for about 2 years now and suddenly the code for the doors stopped working online but still work solo

-------------------------------
level = script.Parent.Settings.Level
-------------------------------

function getPlayer(humanoid) 
local players = game.Players:children() 
for i = 1, #players do 
if players[i].Character.Humanoid == humanoid then return players[i] end 
end 
end

Door = script.Parent
function onTouched(hit)
        print("Lvl Door Hit! :O")
        local human = hit.Parent:findFirstChild("Humanoid")
        if (human ~= nil ) then
            print("Human touched Lvl door! :O")
            local player = getPlayer(human) 

if (player == nil) then return end 
local stats = player:findFirstChild("leaderstats") 
local sp = stats:findFirstChild("Lvl") 
if sp == nil then return false end 
if (sp.Value < level.Value) then
                hit.Parent.Torso.Velocity=Door.CFrame.lookVector * 1000 -- Push the Player back             
            end
        end

end

connection = Door.Touched:connect(onTouched)

Idk if this will help but it uses a TouchInterest and 2 settings Lvl and Tag ~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~

0
Have you checked in game for errors? (F9 to access the console) If so, could you please provide what it said? :) Also, I recommend putting prints around 21-24, if the console doesn't return anything, to see where it stops (its execution). TheeDeathCaster 2368 — 7y

1 answer

Log in to vote
-1
Answered by 7 years ago

i had the same thing with all my scripts i fixed it my making all script files local scripts and local scripts script files

0
That's not the issue at hand. There's no hinting w/in his code that it's intended for a specific client, and he said it worked 2 yrs prior. TheeDeathCaster 2368 — 7y
Ad

Answer this question