generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: My sliding door script is TOO slow!

Previous Thread :: Next Thread 
rainbowbluebunny is not online. rainbowbluebunny
Joined: 22 Mar 2015
Total Posts: 5
17 Jul 2017 08:30 AM
So, i have this sliding door script with a handle, when you touch the handle [the handle is called "Interactive"] the door slides, it works and all, but the door sliding animation thing is TOO slow!!

This is my script.

local ClickerModule = re##################local clickEvent = ClickerModule.RemoteEvent
local interactiveParts = {}##local activationDistance = 11
local doorOpen = false
local changingState = false
local sound = script.Parent.Glass.Sound

for i, v in pairs(script.Parent:GetChildren()) do
if v.Name == "Interactive" then
table.insert(interactiveParts, v)
end
end

local function distanceToCharacter(player, part)
local character = player.Character
if character then
local torso = character:FindFirstChild("Torso")
if torso then
return((torso.Position - part.Position).magnitude)
end
end
return math.huge
end

clickEvent.OnServerEvent:connect(function(player, part)
local isPart = false
for i = 1, #interactiveParts do
if part == interactiveParts[i] then
isPart = true
end
end
if isPart and player.Character and distanceToCharacter(player, part) <= activationDistance then
if doorOpen == true and changingState == false then
changingState = true
sound.TimePosition = 3
sound:Play()
for i = 1, 30 do
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame * CFrame.new(0.20, 0, 0))

end
sound:Stop()
changingState = false
doorOpen = false
elseif changingState == false then
changingState = true
sound.TimePosition = 0.1
sound:Play()
for i = 1, 30 do
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame * CFrame.new(-0.20, 0, 0))

end
sound:Stop()
changingState = false
doorOpen = true
end
end
end)

-- I took out the "wait ()" bit and now it just doesn't slide at all.
please help.
Report Abuse
rainbowbluebunny is not online. rainbowbluebunny
Joined: 22 Mar 2015
Total Posts: 5
17 Jul 2017 08:31 AM
local ClickerModule = require(343254562)***
Report Abuse
Thezi is online. Thezi
Joined: 23 May 2014
Total Posts: 253
17 Jul 2017 08:36 AM
instead of .2 try .5 of something
Report Abuse
SinisterMemories is not online. SinisterMemories
Joined: 21 Mar 2013
Total Posts: 4892
17 Jul 2017 09:49 AM
if you wrote it you should literally know how to fix this simple problem because you should know where the movement part is


#code print("oh no an errorz!")
Report Abuse
rainbowbluebunny is not online. rainbowbluebunny
Joined: 22 Mar 2015
Total Posts: 5
17 Jul 2017 10:15 AM
If I knew, I wouldn't have posted it. Genius. -_-
Report Abuse
SinisterMemories is not online. SinisterMemories
Joined: 21 Mar 2013
Total Posts: 4892
17 Jul 2017 07:06 PM
make your own scripts?


#code print("oh no an errorz!")
Report Abuse
MCrafter49 is not online. MCrafter49
Joined: 18 Dec 2015
Total Posts: 99
17 Jul 2017 07:18 PM
If ya want you can take my doors and use them, I don't really care.
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
17 Jul 2017 07:27 PM
in the for loop that moves the primarypart make it move x by something more (like -.5 or -.7)

and if you dont understand what i said then make your own scripts


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image