hi all
so this script works when i test my server in studio, but once i publish game the script stopt working in game and in studio :( any help ?
thx
function onClicked(Player)
local torso = Player.Character:findFirstChild("Torso")
if torso ~= nil then
local playertest = Player.Character:findFirstChild("Humanoid")
if playertest ~= nil then
if playertest.Health > 0 then
local stats = Player:findFirstChild("leaderstats")
if stats ~= nil then
local cash = stats:findFirstChild("Floor")
if cash.Value >= 1 then
variable
local location = game.Workspace.floor1.Position
local x = location["X"]
local y = location["Y"]
local z = location["Z"]
in the new position
x = x + math.random(-5, 5)
y = y + 3
z = z + math.random(-5, 5)
local cf = torso.CFrame
torso.CFrame = CFrame.new(Vector3.new(x,y,z))
end
end
end
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

5 comments
is the script a local script?
no, just a normal script on a part in workspace.
What errors are you getting? When you publish, the character rig switches from R6 to R15.
i dont get any error anymore, its like the script just breaks. But i have to say the test only worked whit the r6 models in studio
@Meltdown : Thanks for pointing out the r6 to r15 models ,i just chanched ("Torso") to ("UpperTorso") and now it works fine :)