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

(Data Store)How to get this script working?

Asked by 9 years ago

Ok, I need to store data in my universe for a RPG game. I have tried multiple times and I either failed or Roblox Studio crashed ??? Here is the code:

Player = game.Players.LocalPlayer
player = script.Parent.Parent.Parent.Parent.Parent
Blue = Vector3.new(-5.69, 0.71, -46.92)
Red = Vector3.new(118.13, 84.19, 273.8)
B = script.Mesh1
C = script.Mesh2
while true do
    wait(0.1)
if Player.Data.Class.Value == 1 then
    script.Skin:clone().Parent = player.Character
    local char = player.Character
    local torso = char.Torso    
    torso.CFrame = CFrame.new(Blue)
    wait(0.2)
    torso.CFrame = CFrame.new(Red)
else
if Player.Data.Class.Value == 2 then
script.Skin2:clone().Parent = player.Character
local BC = B:clone()
BC.Parent = player.Character.Head
else
    if Player.Data.Class.Value == 3 then
script.Skin2:clone().Parent = player.Character
local CB = C:clone()
CB.Parent = player.Character.Head
    end
    end
end

Every time I use this Roblox Studio crashes ? I don't know if this will even work. Please help.

0
And this script has no datastore what so ever, MessorAdmin 598 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

I would recommend using :

while wait() do

end

also..

http://wiki.roblox.com/index.php?title=API:Class/GlobalDataStore/UpdateAsync

Ad

Answer this question