#help with refering to a part

1 messages · Page 1 of 1 (latest)

viscid cloak
#

does "local wall = game.Workspace["part 2"].wall" refer to a part inside of of a model named part 2? It doesn't seem to work. the script in the part, "button" is trying to refer to the part thats a wall, but I can't seem to get it to work.

near island
#

yes, is the wall inside the model? in the image it doesnt look like the wall is inside the model you are referencing

viscid cloak
#

uh

#

ya the wall is in the model

#

wait it isn't mb

near island
#

let me know if you get it to work

viscid cloak
#

ya it works, srry for the dumb question lol

#

i didn't realize the solution was so easy

#

how would i make a spinning block? is that scripting related or is there a special thing in studio for that?

sudden sundial
#

If you want it to look smooth tween it

viscid cloak
#

so uh

#

i did the quick fill thing that roblox recommended i did

#

and it spins the wrong way lol

#

what does math.rad do?

sudden sundial
#

Converts degrees to radians

#

Say you want to rotate a part by 30 degrees
To use CFrame.angles() if you put a 30 inside that's 30 radians not degrees

#

Which is massive

#

So you put math.rad(30)

#

Which just means convert 30 degrees to radians so I can use it in CFrame.angles

viscid cloak
#

it is spinning at like mach 30 lol

sudden sundial
#

😭

#

Add a task.wait

#
local RunService = game:GetService("RunService")
local part = script.Parent -- change to your part
local rotationSpeed = 60 -- change this for rotation speed

RunService.RenderStepped:Connect(function(deltaTime)
    local rotation = rotationSpeed * deltaTime
    part.CFrame = part.CFrame * CFrame.Angles(0, math.rad(rotation), 0)
end)
viscid cloak
#

whats the difference between wait() and task.wait()

sudden sundial
#

Wait is the legacy version
Task.wait is more precise and less buggy

#

Wait can depend on server performance

#

So if the server lagged it would affect it

#

And I think your actual frame rate can mess with it

viscid cloak
#

and whats the difference between part.material.neon and enum.material.neon?

#

UH

#

i made the spinning part into a killbrick and it crashed roblox studio

#

local spinner = script.Parent
spinner.CanCollide = true
spinner.Anchored = true
local spinspeed = 5

while true do
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,math.rad(spinspeed),0)
wait(.0001)
spinner.Touched:Connect(function(otherPart)
local humanoid = otherPart.Parent:FindFirstChild("Humanoid")

    if humanoid then
        humanoid.Health = humanoid.Health == 0
        print("player health set to 0")
    end
end)

end

#

ok it unfroze

sudden sundial
#

Part.material is specifically the material property stored inside the part

#

Enum.material gets all the material labels

#

I imagine like a long list of all Roblox materials stored inside it

#

So you can assign part.material = enum.material.metal

Idk if that's how you actually do it

#

But the theory is there

#

Okay don't wait(0.0001) lol

#

May as well not have it