I scripted the whistle within the local script, but it didn’t work in the secondary model. So, I followed to watch my video:
When clicked on the button, it works with the same model named “Thomas”. So, I changed the instance model name, but it doesn’t work either.
There is a local script I worked in:
local Horn = game.Workspace.Thomas.Engine.Body.Whistles.Whistle.WhistleFX -- Put the Whistle/Horn if you want
local Horn2 = game.Workspace.Thomas.Engine.Body.Whistles.Whistle2.WhistleFX
local userInputService = game:GetService("UserInputService")
script.Parent.MouseButton1Click:Connect(function()
Horn.SFX:Play()
Horn2.SFX:Play()
Horn.ParticleEmitter.Enabled = true
Horn2.ParticleEmitter.Enabled = true
wait(1.5)
Horn.ParticleEmitter.Enabled = false
Horn2.ParticleEmitter.Enabled = false
end)
userInputService.InputBegan:Connect(function(input, _gameProcessed)
if input.KeyCode == Enum.KeyCode.H then
Horn.SFX:Play()
Horn2.SFX:Play()
Horn.ParticleEmitter.Enabled = true
Horn2.ParticleEmitter.Enabled = true
wait(1.5)
Horn.ParticleEmitter.Enabled = false
Horn2.ParticleEmitter.Enabled = false
end
end)
I try the FindFirstChild
instance, but it doesn’t work too. How do I script with the same instance model name?