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

[PRO Needed] Can anyone check if my script is correct?

Asked by 5 years ago

I was trying to make a button that if you have enough point and you click the button, it will teleport you to the part. But it keeps giving me error like "Player is not a valid member of DataModel" What can I do to fix this? Someone Help!

script.Parent.MouseButton1Click:connect(function()
if game.Player.leaderstats.LifeFormFound.Value >= 4 then    
 game.Players.LocalPlayer.character.LowerTorso.CFrame = CFrame.new(workspace.Point.Position)
print('Successful')
else print('Fail')
end
end)

Someone Please Help!

0
Is the script a localscript? maumaumaumaumaumau 98 — 5y
0
a script RainbowBeastYT 85 — 5y
0
Ok maumaumaumaumaumau 98 — 5y
0
can you write the answer please, thx RainbowBeastYT 85 — 5y
View all comments (4 more)
0
d0ne maumaumaumaumaumau 98 — 5y
0
If it is correct , mark my answer as correct. maumaumaumaumaumau 98 — 5y
0
ok RainbowBeastYT 85 — 5y
0
Please properly indent your code as it makes it easy to read and debug. User#21908 42 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Make a it a local script , LocalPlayer can't be used by a normal Script. Also You have to use cap at C of connect , Because connect is deprecated , And can be deleted soon by roblox. Here the source for local script.

script.Parent.MouseButton1Click:Connect(function()
    if game.Players.LocalPlayer.leaderstats.LifeFormFound.Value >= 4 then   
     game.Players.LocalPlayer.Character.LowerTorso.CFrame = CFrame.new(workspace.Point.Position)
    print('Successful')
    else print('Fail')
    end
    end)

0
What's a normal script? User#19524 175 — 5y
0
Please properly indent your code as it makes it easy to read and debug. User#21908 42 — 5y
Ad

Answer this question