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

Why doesn't CharacterAdded doesn't execute?

Asked by
Jonibus 30
10 years ago

I have the following script that seems flawless, but for some reason CharacterAdded won't execute. Anyone have any idea why?

game.Players.PlayerAdded:connect(function(p)
local v = Instance.new("IntValue",p)
v.Name = "Values"
print(v.Name)
local coins = Instance.new("IntValue",v)
coins.Name = "Coins"
coins.Value = ds:GetAsync(p.Name.."_Coins") or 0 
print(coins.Name)
local ingame = Instance.new("BoolValue",v)
ingame.Value = false
ingame.Name = "InGame"
print(ingame.Name) -- This prints
p.CharacterAdded:connect(function(c) -- This doesn't execute
print(c.Name) -- This doesn't
wait(.1)
if p.Values.InGame.Value == true then
print('In game')
elseif p.Values.InGame.Value == false then
print('Not in game')
c.Torso.CFrame = CFrame.new(-37.4000015, 10.1999998, 110.300003, 0, 0, 1, 0, 1, 0, -1, 0, -4.37113883e-008)
end
end)
end)

1 answer

Log in to vote
1
Answered by
Dummiez 360 Moderation Voter
10 years ago

The code you posted here doesn't seem to define ds (which I am presuming is to be a Data Store Service)

Otherwise, I can't see anything wrong with your script (other then the fact that it isn't indented properly) :P

Ad

Answer this question