Script wont function even though it's triggered

Hello,
this is the code:

local Bell = game.workspace.bellmodel.Bell.bellhitbox

Bell.ClickDetector.MouseClick:Connect(function(hit)
if Bell.ClickDetector.MouseClick == true then
game.Workspace[“Boat Model”].Position = Vector3(360, 163.12, -80.714)
wait(.05)
game.Workspace[“Boat Model”].Transparency = 0
end
end)

I used print(“Hello world!”) to see if the event was truly being triggered, which it was, but now I’m out of ideas as to why this won’t function.
Any help?

2 Likes

change vector3 to vector3.new
I think that is it

3 Likes

Rewrote your code

local Bell = workspace.bellmodel.Bell.bellhitbox

Bell.ClickDetector.MouseClick:Connect(function(hit)
    workspace["Boat Model"].Position = Vector3.new(360, 163.12, -80.714) -- Vector3.new is the constructor, not just Vector3
    task.wait(.05) -- you should increase this, the amount of time here is way too low to notice anything 
    workspace["Boat Model"].Transparency = 0
end)

Is Boat Model a Model? If so, you cannot use Position and Transparency for that.

2 Likes

oh well yes its a model, I didn’t know.
also the wait time is temporary ill change it to the time it takes for a certain sound file
also thanks for the notes I’m new as you can tell lol

To move the model, you’d want to use Model:PivotTo

workspace["Boat Model"]:PivotTo(CFrame.new(360, 163.12, -80.714))
-- We switch Vector3 to CFrame because we're modifying the Model's CFrame

In order to change the model’s transparency, you’d have to loop through the model’s descendants and change all the BaseParts’ Transparency to 0

2 Likes

thanks man, im new so the notes really help
instead of transparency ill just may the boat in the void

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.