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

Adding to an IntValue in the workspace is not gaining effects?

Asked by 3 years ago

Hello, hope you are well today! I am trying to make a racing game, and here, i am trying to do each player place after winning (1st,2nd,3rd).

PlaceGet is a IntValue which tells the place the player will get after touching the winning part,and when a player touches it, it is supposed to change the player's place to its current value and the PlaceGet value gets added by 1.

The problem is that when adding it, it doesnt work very well. Its value doesnt change when i add it, it shows on the print that it changed, but not on the server (The next script is not a LocalScript type).

script.Parent.Touched:Connect(function(Hit)
    print("Hit Fire")
    local Human = Hit.Parent:FindFirstChild("Humanoid")
    if Human then
        print("Detected human")
        local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
        if not Hit.Parent.InWinner.Value and Player ~= nil then
            print("Checked val")
            local Place = workspace.PlaceGet.Value
            local PlayerPlace = require(game.ServerScriptService.PlaceOfPlayers)
            table.insert(PlayerPlace ,Player.Name)
            Hit.Parent.InPlace.Value = Place
            Hit.Parent.InWinner.Value = true
            Place += 1
            print(Place)
        end
    end
end)

PlayerPlace is a table, where stores in order which player won first, second, etc.

Thanks, If you need more info ask.

0
This would mean that the script works locally, but not in the server, you can try using a RemoteFunction, it might work that way. KingDomas 153 — 3y
0
No more answers,already solved it. yuni_Boy1234 320 — 3y

Answer this question